package com.codi.api.xxljob;

import com.codi.base.exception.BaseAppException;
import com.codi.bus.core.service.FundNetValueBackService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author lvgo
 * @version 1.0
 * @Description: 货币型基金净值表现
 * 0 0 2 ? * *
 * @date 18-6-29 下午4:43
 */
@Slf4j
@Component
@JobHandler("fundNetValuePerformanceHandler")
public class FundNetValuePerformanceHandler extends IJobHandler {
    @Resource
    private FundNetValueBackService fundNetValueBackService;

    @Override
    public ReturnT<String> execute(String s) throws Exception {
        log.info("update fund net value begin");

        try {
            fundNetValueBackService.updateFundNetValue();
        } catch (BaseAppException e) {
            log.error(e.getMessage(), e);
        }
        XxlJobLogger.log("FundNetValuePerformance-JOB, success");

        return SUCCESS;
    }
}
